<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Update Employee Information</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/index_work.css">
</head>
<body>

<form action="${pageContext.request.contextPath}/employee" method="post">
    <input type="hidden" name="_method" value="PUT">
    <input type="hidden" name="id" value="${requestScope.employee.id}">
    <table>
        <tr>
            <th colspan="6">Update Employee Information</th>
        </tr>
        <tr>
            <td>LASTNAME</td>
            <td>
                <input type="text" name="lastName" value="${requestScope.employee.lastName}">
            </td>
        </tr>
        <tr>
            <td>EMAIL</td>
            <td>
                <input type="text" name="email" value="${requestScope.employee.email}">
            </td>
        </tr>
        <tr>
            <td>GENDER</td>
            <td>
                <%--
                    <input type="radio" name="gender" value="1" ${requestScope.employee.gender==1?"checked":""}>male
                    <input type="radio" name="gender" value="0" ${requestScope.employee.gender==0?"checked":""}>female
                --%>
                <input type="radio" name="gender" value="1" <c:if test="${requestScope.employee.gender==1}">checked</c:if>>male
                <input type="radio" name="gender" value="0" <c:if test="${requestScope.employee.gender==0}">checked</c:if>>female
            </td>
        </tr>
        <tr>
            <td>DEPARTMENT</td>
            <td>
                <select name="department.id">
                    <c:forEach items="${requestScope.departmentList}" var="dept">
                        <%--
                            <option value="${pageScope.dept.id}" ${requestScope.employee.department.id==pageScope.dept.id?"selected":""}>${pageScope.dept.departmentName}</option>
                        --%>
                        <option value="${pageScope.dept.id}" <c:if test="${requestScope.employee.department.id==pageScope.dept.id}">selected</c:if>>${pageScope.dept.departmentName}</option>
                    </c:forEach>
                </select>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" value="UPDATE">
            </td>
        </tr>
    </table>
</form>

</body>
</html>
